using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using ST.Application.MenuServices;

namespace Portal.Components
{
    [ViewComponent(Name = "Navigation")]
    public class NavigationViewComponent:ViewComponent
    {
        private readonly IMenuService _menuService;

        public NavigationViewComponent(IMenuService menuService)
        {
            _menuService = menuService;
        }
        public async Task<IViewComponentResult> InvokeAsync()
        {
            var userId = HttpContext.Session.GetString("CurrentUserId");
            var menus =await _menuService.GetMenusByUser(Guid.Parse(userId));
            return View(menus);
        }
    }
}